home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_teTeX.idb / usr / freeware / teTeX / texmf / dvips / psfrag / psfrag.pro.z / psfrag.pro
Encoding:
Text File  |  1999-01-26  |  5.1 KB  |  155 lines

  1. %%
  2. %% This is file `psfrag.pro',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% psfrag.dtx  (with options: `filepro')
  8. %% 
  9. %% Copyright (c) 1996 Craig Barratt, Michael C. Grant, and David Carlisle.
  10. %% All rights reserved.
  11. %% 
  12. %% This file is part of the PSfrag package.
  13. %% 
  14. userdict begin
  15. /PSfragLib 90 dict def
  16. /PSfragDict 6 dict def
  17. /PSfrag { PSfragLib begin load exec end } bind def
  18. end
  19. PSfragLib begin
  20. /RO /readonly      load def
  21. /CP /currentpoint  load def
  22. /CM /currentmatrix load def
  23. /B { bind RO def } bind def
  24. /X { exch def } B
  25. /MD { { X } forall } B
  26. /OE { end exec PSfragLib begin } B
  27. /tstr 8 string def
  28. /islev2 { languagelevel } stopped { false } { 2 ge } ifelse def
  29. [ /tM /srcM /dstM /dM /idM /srcFM /dstFM ] { matrix def } forall
  30. dM defaultmatrix RO idM invertmatrix RO pop
  31. srcFM identmatrix pop
  32. /Hide { gsave { CP } stopped not newpath clip { moveto } if } B
  33. /Unhide { { CP } stopped not grestore { moveto } if } B
  34. /setrepl islev2 {{ /glob currentglobal def true setglobal array astore
  35.                    globaldict exch /PSfrags exch put glob setglobal }}
  36.                 {{ array astore /PSfrags X }} ifelse B
  37. /getrepl islev2 {{ globaldict /PSfrags get aload length }}
  38.                 {{ PSfrags aload length }} ifelse B
  39. /convert {
  40.    /src X src length string
  41.    /c 0 def src length {
  42.       dup c src c get dup 32 lt { pop 32 } if put /c c 1 add def
  43.    } repeat
  44. } B
  45. /Begin {
  46.     /saver save def
  47.     srcFM exch 3 exch put
  48.     0 ne /debugMode X 0 setrepl
  49.     dup /S exch dict def { S 3 1 roll exch convert exch put } repeat
  50.     srcM CM dup invertmatrix pop
  51.     mark { currentdict { end } stopped { pop exit } if } loop
  52.     PSfragDict counttomark { begin } repeat pop
  53. } B
  54. /End {
  55.     mark { currentdict end dup PSfragDict eq { pop exit } if } loop
  56.     counttomark { begin } repeat pop
  57.     getrepl saver restore
  58.     7 idiv dup /S exch dict def {
  59.         6 array astore /mtrx X tstr cvs /K X
  60.         S K [ S K known { S K get aload pop } if mtrx ] put
  61.     } repeat
  62. } B
  63. /Place {
  64.     tstr cvs /K X
  65.     S K known {
  66.         bind /proc X tM CM pop
  67.         CP /cY X /cX X
  68.         0 0 transform idtransform neg /aY X neg /aX X
  69.         S K get dup length /maxiter X
  70.         /iter 1 def {
  71.             iter maxiter ne { /saver save def } if
  72.             tM setmatrix aX aY translate
  73.             [ exch aload pop idtransform ] concat
  74.             cX neg cY neg translate cX cY moveto
  75.             /proc load OE
  76.             iter maxiter ne { saver restore /iter iter 1 add def } if
  77.         } forall
  78.         /noXY { CP /cY X /cX X } stopped def
  79.         tM setmatrix noXY { newpath } { cX cY moveto } ifelse
  80.     } {
  81.         Hide OE Unhide
  82.     } ifelse
  83. } B
  84. /normalize {
  85.     2 index dup mul 2 index dup mul add sqrt div
  86.     dup 4 -1 roll exch mul 3 1 roll mul
  87. } B
  88. /replace {
  89.     aload pop MD
  90.     CP /bY X /lX X gsave initmatrix
  91.     str stringwidth abs exch abs add dup 0 eq
  92.         { pop } { 360 exch div dup scale } ifelse
  93.     lX neg bY neg translate newpath lX bY moveto
  94.     str { /ch X ( ) dup 0 ch put false charpath ch Kproc } forall
  95.     flattenpath pathbbox [ /uY /uX /lY /lX ] MD
  96.     CP grestore moveto
  97.     currentfont /FontMatrix get dstFM copy dup
  98.     0 get 0 lt { uX lX /uX X /lX X } if
  99.     3 get 0 lt { uY lY /uY X /lY X } if
  100.     /cX uX lX add 0.5 mul def
  101.     /cY uY lY add 0.5 mul def
  102.     debugMode { gsave 0 setgray 1 setlinewidth
  103.         lX lY moveto lX uY lineto uX uY lineto uX lY lineto closepath
  104.         lX bY moveto uX bY lineto lX cY moveto uX cY lineto
  105.         cX lY moveto cX uY lineto stroke
  106.     grestore } if
  107.     dstFM dup invertmatrix dstM CM srcM
  108.     2 { dstM concatmatrix } repeat pop
  109.     getrepl /temp X
  110.         S str convert get {
  111.             aload pop [ /rot /scl /loc /K ] MD
  112.             /aX cX def /aY cY def
  113.             loc {
  114.                 dup 66  eq { /aY bY def } { % B
  115.                 dup 98  eq { /aY lY def } { % b
  116.                 dup 108 eq { /aX lX def } { % l
  117.                 dup 114 eq { /aX uX def } { % r
  118.                 dup 116 eq { /aY uY def }   % t
  119.                 if } ifelse } ifelse } ifelse } ifelse pop
  120.             } forall
  121.             K srcFM rot tM rotate dstM
  122.             2 { tM concatmatrix } repeat aload pop pop pop
  123.             2 { scl normalize 4 2 roll } repeat
  124.             aX aY transform
  125.             /temp temp 7 add def
  126.         } forall
  127.     temp setrepl
  128. } B
  129. /Rif {
  130.     S 3 index convert known { pop replace } { exch pop OE } ifelse
  131. } B
  132. /XA { bind [ /Kproc /str } B /XC { ] 2 array astore def } B
  133. /xs   { pop } XA XC
  134. /xks  { /kern load OE } XA /kern XC
  135. /xas  { pop ax ay rmoveto } XA /ay /ax XC
  136. /xws  { c eq { cx cy rmoveto } if } XA /c /cy /cx XC
  137. /xaws { ax ay rmoveto c eq { cx cy rmoveto } if }
  138.     XA /ay /ax /c /cy /cx XC
  139. /raws { xaws { awidthshow } Rif } B
  140. /rws  { xws { widthshow } Rif } B
  141. /rks  { xks { kshow } Rif } B
  142. /ras  { xas { ashow } Rif } B
  143. /rs   { xs { show } Rif } B
  144. /rrs { getrepl dup 2 add -1 roll restore setrepl } B
  145. PSfragDict begin
  146. islev2 not { /restore { /rrs PSfrag } B } if
  147. /show       { /rs   PSfrag } B
  148. /kshow      { /rks  PSfrag } B
  149. /ashow      { /ras  PSfrag } B
  150. /widthshow  { /rws  PSfrag } B
  151. /awidthshow { /raws PSfrag } B
  152. end PSfragDict RO pop
  153. end
  154.  
  155.